home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / bbs / Hydra11s.lha / HBBS / Source / Node / NodeGUI.c < prev    next >
C/C++ Source or Header  |  1996-06-25  |  20KB  |  654 lines

  1. /*********************************************/
  2. /*                                           */
  3. /*       Designer (C) Ian OConnor 1994       */
  4. /*                                           */
  5. /*      Designer Produced C include file     */
  6. /*                                           */
  7. /*********************************************/
  8.  
  9.  
  10.  
  11. #include <exec/types.h>
  12. #include <exec/memory.h>
  13. #include <dos/dosextens.h>
  14. #include <intuition/screens.h>
  15. #include <intuition/intuition.h>
  16. #include <intuition/gadgetclass.h>
  17. #include <libraries/gadtools.h>
  18. #include <diskfont/diskfont.h>
  19. #include <utility/utility.h>
  20. #include <graphics/gfxbase.h>
  21. #include <workbench/workbench.h>
  22. #include <graphics/scale.h>
  23. #include <clib/exec_protos.h>
  24. #include <clib/wb_protos.h>
  25. #include <clib/intuition_protos.h>
  26. #include <clib/gadtools_protos.h>
  27. #include <clib/graphics_protos.h>
  28. #include <clib/utility_protos.h>
  29. #include <string.h>
  30. #include <clib/diskfont_protos.h>
  31.  
  32. #include "NodeGUI.h"
  33.  
  34. #include "/common/types.h"
  35. #include "/common/defines.h"
  36. #include "/common/structures.h"
  37.  
  38. extern struct NodeData *N_ND;
  39.  
  40.  
  41. ULONG BevelTags[] =
  42.   {
  43.   (GTBB_Recessed), TRUE,
  44.   (GT_VisualInfo), 0,
  45.   (TAG_DONE)
  46.   };
  47.  
  48. struct IntuiText NodeWndTexts[] =
  49.   {
  50.   1, 3, JAM1, 5, 3, &HBBS8066, (UBYTE *)"Name", &NodeWndTexts[1],
  51.   1, 3, JAM1, 165, 3, &HBBS8066, (UBYTE *)"Group", &NodeWndTexts[2],
  52.   1, 3, JAM1, 325, 3, &HBBS8066, (UBYTE *)"Action", &NodeWndTexts[3],
  53.   1, 3, JAM1, 557, 3, &HBBS8066, (UBYTE *)"CPS/BAUD", NULL
  54.   };
  55.  
  56. struct Window *NodeWnd = NULL;
  57. APTR NodeWndVisualInfo;
  58. APTR NodeWndDrawInfo;
  59. struct Gadget *NodeWndGList;
  60. struct Gadget *NodeWndGadgets[8];
  61. UBYTE NodeWndFirstRun = 0;
  62.  
  63. STRPTR NodeWnd_ChatFlagLabels[] =
  64. {
  65.   (STRPTR)"Chat ON",
  66.   (STRPTR)"Chat OFF",
  67.   NULL
  68. };
  69.  
  70. STRPTR NodeWnd_OffHookLabels[] =
  71. {
  72.   (STRPTR)"OnHook",
  73.   (STRPTR)"OffHook",
  74.   NULL
  75. };
  76.  
  77. STRPTR NodeWnd_ReserveLabels[] =
  78. {
  79.   (STRPTR)"UnReserved",
  80.   (STRPTR)"Reserved",
  81.   NULL
  82. };
  83.  
  84. ULONG NodeWndGadgetTags[] =
  85.   {
  86.   (GTCY_Labels), (ULONG)&NodeWnd_ChatFlagLabels[0],
  87.   (TAG_END),
  88.   (GTCY_Labels), (ULONG)&NodeWnd_OffHookLabels[0],
  89.   (TAG_END),
  90.   (GTCY_Labels), (ULONG)&NodeWnd_ReserveLabels[0],
  91.   (TAG_END),
  92.   };
  93.  
  94. UWORD NodeWndGadgetTypes[] =
  95.   {
  96.   BUTTON_KIND,
  97.   BUTTON_KIND,
  98.   BUTTON_KIND,
  99.   BUTTON_KIND,
  100.   BUTTON_KIND,
  101.   CYCLE_KIND,
  102.   CYCLE_KIND,
  103.   CYCLE_KIND,
  104.   };
  105.  
  106. struct NewGadget NodeWndNewGad[] =
  107.   {
  108.   311, 27, 87, 12, (UBYTE *)"Init Modem", &HBBS8066, NodeWnd_InitModem, 16, NULL,  NULL,
  109.   463, 27, 52, 12, (UBYTE *)"Chat", &HBBS8066, NodeWnd_ChatNow, 16, NULL,  NULL,
  110.   516, 27, 71, 12, (UBYTE *)"Settings", &HBBS8066, NodeWnd_Settings, 16, NULL,  NULL,
  111.   588, 27, 42, 12, (UBYTE *)"Info", &HBBS8066, NodeWnd_Information, 16, NULL,  NULL,
  112.   399, 27, 63, 12, (UBYTE *)"Watch", &HBBS8066, NodeWnd_Screen, 16, NULL,  NULL,
  113.   2, 27, 98, 12, NULL, &HBBS8066, NodeWnd_ChatFlag, 1, NULL,  (APTR)&NodeWndGadgetTags[0],
  114.   101, 27, 93, 12, NULL, &HBBS8066, NodeWnd_OffHook, 1, NULL,  (APTR)&NodeWndGadgetTags[3],
  115.   195, 27, 115, 12, NULL, &HBBS8066, NodeWnd_Reserve, 1, NULL,  (APTR)&NodeWndGadgetTags[6],
  116.   };
  117. UWORD NodeWndZoomInfo[4] = { 0, 11, 196, 11 };
  118.  
  119. struct Window *InfoWin = NULL;
  120. APTR InfoWinVisualInfo;
  121. APTR InfoWinDrawInfo;
  122. struct Gadget *InfoWinGList;
  123. struct Gadget *InfoWinGadgets[5];
  124. UBYTE InfoWinFirstRun = 0;
  125.  
  126. STRPTR InfoWin_LV1_Cycle1Labels[] =
  127. {
  128.   (STRPTR)"Callers",
  129.   (STRPTR)"Uploads",
  130.   (STRPTR)"Downloads",
  131.   (STRPTR)"Pagers",
  132.   (STRPTR)"PWFails",
  133.   (STRPTR)"Carrier Losses",
  134.   NULL
  135. };
  136.  
  137. ULONG InfoWinGadgetTags[] =
  138.   {
  139.   (GTCY_Labels), (ULONG)&InfoWin_LV1_Cycle1Labels[0],
  140.   (TAG_END),
  141.   (GTLV_Selected), 0,
  142.   (TAG_END),
  143.   (GTNM_Border), TRUE,
  144.   (TAG_END),
  145.   (GTNM_Border), TRUE,
  146.   (TAG_END),
  147.   (GTNM_Border), TRUE,
  148.   (TAG_END),
  149.   };
  150.  
  151. UWORD InfoWinGadgetTypes[] =
  152.   {
  153.   CYCLE_KIND,
  154.   LISTVIEW_KIND,
  155.   NUMBER_KIND,
  156.   NUMBER_KIND,
  157.   NUMBER_KIND,
  158.   };
  159.  
  160. struct NewGadget InfoWinNewGad[] =
  161.   {
  162.   10, 34, 237, 14, NULL, &HBBS8066, InfoWin_LV1_Cycle1, 1, NULL,  (APTR)&InfoWinGadgetTags[0],
  163.   10, 49, 236, 100, NULL, &HBBS8066, InfoWin_LV1, 1, NULL,  (APTR)&InfoWinGadgetTags[3],
  164.   63, 8, 45, 12, (UBYTE *)"Calls", &HBBS8066, InfoWin_Calls, 1, NULL,  (APTR)&InfoWinGadgetTags[6],
  165.   139, 8, 34, 12, (UBYTE *)"UL", &HBBS8066, InfoWin_Uploads, 1, NULL,  (APTR)&InfoWinGadgetTags[9],
  166.   208, 8, 34, 12, (UBYTE *)"DL", &HBBS8066, InfoWin_Downloads, 1, NULL,  (APTR)&InfoWinGadgetTags[12],
  167.   };
  168. UWORD InfoWinZoomInfo[4] = { 306, 153, 243, 18 };
  169.  
  170. struct IntuiText SettingsWinTexts[] =
  171.   {
  172.   2, 0, JAM2, 13, 4, &topa81281, (UBYTE *)"Screen/Window Settings", &SettingsWinTexts[1],
  173.   2, 0, JAM2, 13, 55, &topa81281, (UBYTE *)"Modem Settings", &SettingsWinTexts[2],
  174.   2, 0, JAM2, 13, 101, &HBBS8066, (UBYTE *)"Misc Settings", NULL
  175.   };
  176.  
  177. struct Window *SettingsWin = NULL;
  178. APTR SettingsWinVisualInfo;
  179. APTR SettingsWinDrawInfo;
  180. struct Gadget *SettingsWinGList;
  181. struct Gadget *SettingsWinGadgets[9];
  182. UBYTE SettingsWinFirstRun = 0;
  183.  
  184. STRPTR SettingsWin_WinOrScreenLabels[] =
  185. {
  186.   (STRPTR)"Use Screen",
  187.   (STRPTR)"Use Window",
  188.   NULL
  189. };
  190.  
  191. ULONG SettingsWinGadgetTags[] =
  192.   {
  193.   (GTCY_Labels), (ULONG)&SettingsWin_WinOrScreenLabels[0],
  194.   (TAG_END),
  195.   (GTCB_Checked), TRUE,
  196.   (TAG_END),
  197.   };
  198.  
  199. UWORD SettingsWinGadgetTypes[] =
  200.   {
  201.   BUTTON_KIND,
  202.   CYCLE_KIND,
  203.   CHECKBOX_KIND,
  204.   CHECKBOX_KIND,
  205.   CHECKBOX_KIND,
  206.   BUTTON_KIND,
  207.   BUTTON_KIND,
  208.   BUTTON_KIND,
  209.   BUTTON_KIND,
  210.   };
  211.  
  212. struct NewGadget SettingsWinNewGad[] =
  213.   {
  214.   12, 15, 129, 12, (UBYTE *)"Pick Mode", &HBBS8066, SettingsWin_ScreenMode, 16, NULL,  NULL,
  215.   12, 30, 129, 12, NULL, &HBBS8066, SettingsWin_WinOrScreen, 2, NULL,  (APTR)&SettingsWinGadgetTags[0],
  216.   12, 65, 26, 11, (UBYTE *)"Modem Debug", &HBBS8066, SettingsWin_ModemDebug, 2, NULL,  NULL,
  217.   12, 77, 26, 11, (UBYTE *)"Modem Log", &HBBS8066, SettingsWin_ModemLog, 2, NULL,  NULL,
  218.   12, 111, 26, 11, (UBYTE *)"Allow Logins", &HBBS8066, SettingsWin_AllowLogins, 2, NULL,  (APTR)&SettingsWinGadgetTags[3],
  219.   143, 15, 129, 12, (UBYTE *)"Save Windows", &HBBS8066, SettingsWin_SaveWin, 16, NULL,  NULL,
  220.   143, 65, 129, 12, (UBYTE *)"Device Config", &HBBS8066, SettingsWin_DeviceConfig, 16, NULL,  NULL,
  221.   143, 111, 129, 12, (UBYTE *)"Node Config", &HBBS8066, SettingsWin_NodeConfig, 16, NULL,  NULL,
  222.   143, 127, 129, 12, (UBYTE *)"Callers Log", &HBBS8066, SettingsWin_CallersLog, 16, NULL,  NULL,
  223.   };
  224. UWORD SettingsWinZoomInfo[4] = { 200, 0, 200, 25 };
  225.  
  226. struct Library *DiskfontBase = NULL;
  227. struct Library *GadToolsBase = NULL;
  228. struct GfxBase *GfxBase = NULL;
  229. struct IntuitionBase *IntuitionBase = NULL;
  230. struct LocaleBase *LocaleBase = NULL;
  231.  
  232. APTR WaitPointer = NULL;
  233. UWORD WaitPointerData[] =
  234.     {
  235.     0x0000,0x0000,0x0400,0x07c0,
  236.     0x0000,0x07c0,0x0100,0x0380,
  237.     0x0000,0x07e0,0x07c0,0x1ff8,
  238.     0x1ff0,0x3fec,0x3ff8,0x7fde,
  239.     0x3ff8,0x7fbe,0x7ffc,0xff7f,
  240.     0x7ffc,0xffff,0x7ffc,0xffff,
  241.     0x3ff8,0x7ffe,0x3ff8,0x7ffe,
  242.     0x1ff0,0x3ffc,0x07c0,0x1ff8,
  243.     0x0000,0x07e0,0x0000,0x0000
  244.     };
  245.  
  246. struct TextAttr HBBS8066 = { (STRPTR)"HBBS.font", 8, 0, 66 };
  247. struct TextAttr topa81281 = { (STRPTR)"topaz", 8, 128, 1 };
  248.  
  249. void RendWindowNodeWnd( struct Window *Win, void *vi )
  250. {
  251. int loop;
  252. UWORD offx = Win->BorderLeft;
  253. UWORD offy = Win->BorderTop;
  254. if (Win != NULL)
  255.   {
  256.   BevelTags[3] = (ULONG)vi;
  257.   DrawBevelBoxA( Win->RPort, 1+offx,1+offy,629,12, (struct TagItem *)(&BevelTags[2]));
  258.   DrawBevelBoxA( Win->RPort, 1+offx,14+offy,629,12, (struct TagItem *)(&BevelTags[2]));
  259.   for( loop=0; loop<4; loop++)
  260.     if (NodeWndTexts[loop].ITextFont==NULL)
  261.       NodeWndTexts[loop].ITextFont=Win->WScreen->Font;
  262.   PrintIText( Win->RPort, NodeWndTexts, offx, offy);
  263.   }
  264. }
  265.  
  266. int OpenNodeWndWindow( struct Screen *Scr)
  267. {
  268. UWORD offx, offy;
  269. UWORD loop;
  270. struct NewGadget newgad;
  271. struct Gadget *Gad;
  272. struct Gadget *Gad2;
  273. APTR Cla;
  274. if (NodeWndFirstRun == 0)
  275.   {
  276.   NodeWndFirstRun = 1;
  277.   }
  278. if (NodeWnd == NULL)
  279.   {
  280.   offx = Scr->WBorLeft;
  281.   offy = Scr->WBorTop + Scr->Font->ta_YSize+1;
  282.   if (NULL != ( NodeWndVisualInfo = GetVisualInfoA( Scr, NULL)))
  283.     {
  284.     if (NULL != ( NodeWndDrawInfo = GetScreenDrawInfo( Scr)))
  285.       {
  286.       NodeWndGList = NULL;
  287.       Gad = CreateContext( &NodeWndGList);
  288.       for ( loop=0 ; loop<8 ; loop++ )
  289.         if (NodeWndGadgetTypes[loop] != 198)
  290.           {
  291.           CopyMem((char * )&NodeWndNewGad[loop], ( char * )&newgad, (long)sizeof( struct NewGadget ));
  292.           newgad.ng_VisualInfo = NodeWndVisualInfo;
  293.           newgad.ng_LeftEdge += offx;
  294.           newgad.ng_TopEdge += offy;
  295.           NodeWndGadgets[ loop ] = NULL;
  296.           NodeWndGadgets[ newgad.ng_GadgetID - NodeWndFirstID ] = Gad = CreateGadgetA( NodeWndGadgetTypes[loop], Gad, &newgad, newgad.ng_UserData );
  297.           }
  298.       for ( loop=0 ; loop<8 ; loop++ )
  299.         if (NodeWndGadgetTypes[loop] == 198)
  300.           {
  301.           NodeWndGadgets[ loop ] = NULL;
  302.           Cla = NULL;
  303.           if (Gad)
  304.             NodeWndGadgets[ loop ] = Gad2 = (struct Gadget *) NewObjectA( (struct IClass *)Cla, NodeWndNewGad[ loop ].ng_GadgetText, NodeWndNewGad[ loop ].ng_UserData );
  305.           }
  306.       if (Gad != NULL)
  307.         {
  308.         if (NULL != (NodeWnd = OpenWindowTags( NULL,
  309.                 (WA_Left), N_ND->NodeX,
  310.                 (WA_Top), N_ND->NodeY,
  311.                 (WA_Width), 636+offx,
  312.                 (WA_Height), 42+offy,
  313.                 (WA_Title), "",
  314.                 (WA_MinWidth), 200,
  315.                 (WA_MinHeight), 11,
  316.                 (WA_MaxWidth), 65534,
  317.                 (WA_MaxHeight), 65534,
  318.                 (WA_DragBar), TRUE,
  319.                 (WA_DepthGadget), TRUE,
  320.                 (WA_CloseGadget), TRUE,
  321.                 (WA_Activate), TRUE,
  322.                 (WA_Dummy+0x30), TRUE,
  323.                 (WA_SmartRefresh), TRUE,
  324.                 (WA_Gadgets), NodeWndGList,
  325.                 (WA_Zoom), NodeWndZoomInfo,
  326.                 (WA_PubScreen) , (LONG)Scr,
  327.                 (WA_IDCMP),2097732,
  328.                 (TAG_END))))
  329.           {
  330.           RendWindowNodeWnd(NodeWnd, NodeWndVisualInfo );
  331.           GT_RefreshWindow( NodeWnd, NULL);
  332.           RefreshGList( NodeWndGList, NodeWnd, NULL, ~0);
  333.           return( 0L );
  334.           }
  335.         }
  336.       FreeGadgets( NodeWndGList);
  337.       FreeScreenDrawInfo( Scr, NodeWndDrawInfo );
  338.       }
  339.     FreeVisualInfo( NodeWndVisualInfo );
  340.     }
  341.   }
  342. else
  343.   {
  344.   WindowToFront(NodeWnd);
  345.   ActivateWindow(NodeWnd);
  346.   return( 1L );
  347.   }
  348. return( 1L );
  349. }
  350.  
  351. void CloseNodeWndWindow( void )
  352. {
  353. if (NodeWnd != NULL)
  354.   {
  355.   FreeScreenDrawInfo( NodeWnd->WScreen, NodeWndDrawInfo );
  356.   NodeWndDrawInfo = NULL;
  357.   CloseWindow( NodeWnd);
  358.   NodeWnd = NULL;
  359.   FreeVisualInfo( NodeWndVisualInfo);
  360.   FreeGadgets( NodeWndGList);
  361.   }
  362. }
  363.  
  364. void RendWindowInfoWin( struct Window *Win, void *vi )
  365. {
  366. UWORD offx = Win->BorderLeft;
  367. UWORD offy = Win->BorderTop;
  368. if (Win != NULL)
  369.   {
  370.   BevelTags[3] = (ULONG)vi;
  371.   DrawBevelBoxA( Win->RPort, 10+offx,6+offy,236,16, (struct TagItem *)(&BevelTags[2]));
  372.   DrawBevelBoxA( Win->RPort, 2+offx,1+offy,252,26, (struct TagItem *)(&BevelTags[0]));
  373.   DrawBevelBoxA( Win->RPort,2+4+offx,1+2+offy,252-8,26-4, (struct TagItem *)(&BevelTags[2]));
  374.   DrawBevelBoxA( Win->RPort, 2+offx,29+offy,252,125, (struct TagItem *)(&BevelTags[0]));
  375.   DrawBevelBoxA( Win->RPort,2+4+offx,29+2+offy,252-8,125-4, (struct TagItem *)(&BevelTags[2]));
  376.   }
  377. }
  378.  
  379. int OpenInfoWinWindow( struct Screen *Scr)
  380. {
  381. UWORD offx, offy;
  382. UWORD loop;
  383. struct NewGadget newgad;
  384. struct Gadget *Gad;
  385. struct Gadget *Gad2;
  386. APTR Cla;
  387. if (InfoWinFirstRun == 0)
  388.   {
  389.   InfoWinFirstRun = 1;
  390.   }
  391. if (InfoWin == NULL)
  392.   {
  393.   offx = Scr->WBorLeft;
  394.   offy = Scr->WBorTop + Scr->Font->ta_YSize+1;
  395.   if (NULL != ( InfoWinVisualInfo = GetVisualInfoA( Scr, NULL)))
  396.     {
  397.     if (NULL != ( InfoWinDrawInfo = GetScreenDrawInfo( Scr)))
  398.       {
  399.       InfoWinGList = NULL;
  400.       Gad = CreateContext( &InfoWinGList);
  401.       for ( loop=0 ; loop<5 ; loop++ )
  402.         if (InfoWinGadgetTypes[loop] != 198)
  403.           {
  404.           CopyMem((char * )&InfoWinNewGad[loop], ( char * )&newgad, (long)sizeof( struct NewGadget ));
  405.           newgad.ng_VisualInfo = InfoWinVisualInfo;
  406.           newgad.ng_LeftEdge += offx;
  407.           newgad.ng_TopEdge += offy;
  408.           InfoWinGadgets[ loop ] = NULL;
  409.           InfoWinGadgets[ newgad.ng_GadgetID - InfoWinFirstID ] = Gad = CreateGadgetA( InfoWinGadgetTypes[loop], Gad, &newgad, newgad.ng_UserData );
  410.           }
  411.       for ( loop=0 ; loop<5 ; loop++ )
  412.         if (InfoWinGadgetTypes[loop] == 198)
  413.           {
  414.           InfoWinGadgets[ loop ] = NULL;
  415.           Cla = NULL;
  416.           if (Gad)
  417.             InfoWinGadgets[ loop ] = Gad2 = (struct Gadget *) NewObjectA( (struct IClass *)Cla, InfoWinNewGad[ loop ].ng_GadgetText, InfoWinNewGad[ loop ].ng_UserData );
  418.           }
  419.       if (Gad != NULL)
  420.         {
  421.         if (NULL != (InfoWin = OpenWindowTags( NULL, (WA_Left), 342,
  422.                 (WA_Top), 82,
  423.                 (WA_Width), 260+offx,
  424.                 (WA_Height), 158+offy,
  425.                 (WA_Title), "",
  426.                 (WA_MinWidth), 150,
  427.                 (WA_MinHeight), 25,
  428.                 (WA_MaxWidth), 1200,
  429.                 (WA_MaxHeight), 1200,
  430.                 (WA_DragBar), TRUE,
  431.                 (WA_DepthGadget), TRUE,
  432.                 (WA_CloseGadget), TRUE,
  433.                 (WA_Activate), TRUE,
  434.                 (WA_Dummy+0x30), TRUE,
  435.                 (WA_SmartRefresh), TRUE,
  436.                 (WA_Gadgets), InfoWinGList,
  437.                 (WA_Zoom), InfoWinZoomInfo,
  438.                 (WA_PubScreen) , (LONG)Scr,
  439.                 (WA_IDCMP),4194940,
  440.                 (TAG_END))))
  441.           {
  442.           RendWindowInfoWin(InfoWin, InfoWinVisualInfo );
  443.           GT_RefreshWindow( InfoWin, NULL);
  444.           RefreshGList( InfoWinGList, InfoWin, NULL, ~0);
  445.           return( 0L );
  446.           }
  447.         }
  448.       FreeGadgets( InfoWinGList);
  449.       FreeScreenDrawInfo( Scr, InfoWinDrawInfo );
  450.       }
  451.     FreeVisualInfo( InfoWinVisualInfo );
  452.     }
  453.   }
  454. else
  455.   {
  456.   WindowToFront(InfoWin);
  457.   ActivateWindow(InfoWin);
  458.   return( 0L );
  459.   }
  460. return( 1L );
  461. }
  462.  
  463. void CloseInfoWinWindow( void )
  464. {
  465. if (InfoWin != NULL)
  466.   {
  467.   FreeScreenDrawInfo( InfoWin->WScreen, InfoWinDrawInfo );
  468.   InfoWinDrawInfo = NULL;
  469.   CloseWindow( InfoWin);
  470.   InfoWin = NULL;
  471.   FreeVisualInfo( InfoWinVisualInfo);
  472.   FreeGadgets( InfoWinGList);
  473.   }
  474. }
  475.  
  476. void RendWindowSettingsWin( struct Window *Win, void *vi )
  477. {
  478. int loop;
  479. UWORD offx = Win->BorderLeft;
  480. UWORD offy = Win->BorderTop;
  481. if (Win != NULL)
  482.   {
  483.   BevelTags[3] = (ULONG)vi;
  484.   DrawBevelBoxA( Win->RPort, 2+offx,6+offy,280,44, (struct TagItem *)(&BevelTags[0]));
  485.   DrawBevelBoxA( Win->RPort,2+4+offx,6+2+offy,280-8,44-4, (struct TagItem *)(&BevelTags[2]));
  486.   DrawBevelBoxA( Win->RPort, 2+offx,57+offy,280,37, (struct TagItem *)(&BevelTags[0]));
  487.   DrawBevelBoxA( Win->RPort,2+4+offx,57+2+offy,280-8,37-4, (struct TagItem *)(&BevelTags[2]));
  488.   DrawBevelBoxA( Win->RPort, 2+offx,103+offy,280,69, (struct TagItem *)(&BevelTags[0]));
  489.   DrawBevelBoxA( Win->RPort,2+4+offx,103+2+offy,280-8,69-4, (struct TagItem *)(&BevelTags[2]));
  490.   for( loop=0; loop<3; loop++)
  491.     if (SettingsWinTexts[loop].ITextFont==NULL)
  492.       SettingsWinTexts[loop].ITextFont=Win->WScreen->Font;
  493.   PrintIText( Win->RPort, SettingsWinTexts, offx, offy);
  494.   }
  495. }
  496.  
  497. int OpenSettingsWinWindow( struct Screen *Scr)
  498. {
  499. UWORD offx, offy;
  500. UWORD loop;
  501. struct NewGadget newgad;
  502. struct Gadget *Gad;
  503. struct Gadget *Gad2;
  504. APTR Cla;
  505. if (SettingsWinFirstRun == 0)
  506.   {
  507.   SettingsWinFirstRun = 1;
  508.   }
  509. if (SettingsWin == NULL)
  510.   {
  511.   offx = Scr->WBorLeft;
  512.   offy = Scr->WBorTop + Scr->Font->ta_YSize+1;
  513.   if (NULL != ( SettingsWinVisualInfo = GetVisualInfoA( Scr, NULL)))
  514.     {
  515.     if (NULL != ( SettingsWinDrawInfo = GetScreenDrawInfo( Scr)))
  516.       {
  517.       SettingsWinGList = NULL;
  518.       Gad = CreateContext( &SettingsWinGList);
  519.       for ( loop=0 ; loop<9 ; loop++ )
  520.         if (SettingsWinGadgetTypes[loop] != 198)
  521.           {
  522.           CopyMem((char * )&SettingsWinNewGad[loop], ( char * )&newgad, (long)sizeof( struct NewGadget ));
  523.           newgad.ng_VisualInfo = SettingsWinVisualInfo;
  524.           newgad.ng_LeftEdge += offx;
  525.           newgad.ng_TopEdge += offy;
  526.           SettingsWinGadgets[ loop ] = NULL;
  527.           SettingsWinGadgets[ newgad.ng_GadgetID - SettingsWinFirstID ] = Gad = CreateGadgetA( SettingsWinGadgetTypes[loop], Gad, &newgad, newgad.ng_UserData );
  528.           }
  529.       for ( loop=0 ; loop<9 ; loop++ )
  530.         if (SettingsWinGadgetTypes[loop] == 198)
  531.           {
  532.           SettingsWinGadgets[ loop ] = NULL;
  533.           Cla = NULL;
  534.           if (Gad)
  535.             SettingsWinGadgets[ loop ] = Gad2 = (struct Gadget *) NewObjectA( (struct IClass *)Cla, SettingsWinNewGad[ loop ].ng_GadgetText, SettingsWinNewGad[ loop ].ng_UserData );
  536.           }
  537.       if (Gad != NULL)
  538.         {
  539.         if (NULL != (SettingsWin = OpenWindowTags( NULL, (WA_Left), 153,
  540.                 (WA_Top), 34,
  541.                 (WA_Width), 290+offx,
  542.                 (WA_Height), 177+offy,
  543.                 (WA_Title), "",
  544.                 (WA_MinWidth), 100,
  545.                 (WA_MinHeight), 25,
  546.                 (WA_MaxWidth), 1200,
  547.                 (WA_MaxHeight), 1200,
  548.                 (WA_DragBar), TRUE,
  549.                 (WA_DepthGadget), TRUE,
  550.                 (WA_CloseGadget), TRUE,
  551.                 (WA_Activate), TRUE,
  552.                 (WA_Dummy+0x30), TRUE,
  553.                 (WA_SmartRefresh), TRUE,
  554.                 (WA_AutoAdjust), TRUE,
  555.                 (WA_Gadgets), SettingsWinGList,
  556.                 (WA_Zoom), SettingsWinZoomInfo,
  557.                 (WA_PubScreen) , (LONG)Scr,
  558.                 (WA_IDCMP),580,
  559.                 (TAG_END))))
  560.           {
  561.           RendWindowSettingsWin(SettingsWin, SettingsWinVisualInfo );
  562.           GT_RefreshWindow( SettingsWin, NULL);
  563.           RefreshGList( SettingsWinGList, SettingsWin, NULL, ~0);
  564.           return( 0L );
  565.           }
  566.         }
  567.       FreeGadgets( SettingsWinGList);
  568.       FreeScreenDrawInfo( Scr, SettingsWinDrawInfo );
  569.       }
  570.     FreeVisualInfo( SettingsWinVisualInfo );
  571.     }
  572.   }
  573. else
  574.   {
  575.   WindowToFront(SettingsWin);
  576.   ActivateWindow(SettingsWin);
  577.   return( 0L );
  578.   }
  579. return( 1L );
  580. }
  581.  
  582. void CloseSettingsWinWindow( void )
  583. {
  584. if (SettingsWin != NULL)
  585.   {
  586.   FreeScreenDrawInfo( SettingsWin->WScreen, SettingsWinDrawInfo );
  587.   SettingsWinDrawInfo = NULL;
  588.   CloseWindow( SettingsWin);
  589.   SettingsWin = NULL;
  590.   FreeVisualInfo( SettingsWinVisualInfo);
  591.   FreeGadgets( SettingsWinGList);
  592.   }
  593. }
  594.  
  595. int OpenLibs( void )
  596. {
  597. LocaleBase = (struct LocaleBase * )OpenLibrary((UBYTE *)"locale.library", 38);
  598. if ( NULL != (DiskfontBase = OpenLibrary((UBYTE *)"diskfont.library" , 36)))
  599.   if ( NULL != (GadToolsBase = OpenLibrary((UBYTE *)"gadtools.library" , 37)))
  600.     if ( NULL != (GfxBase = (struct GfxBase * )OpenLibrary((UBYTE *)"graphics.library" , 37)))
  601.       if ( NULL != (IntuitionBase = (struct IntuitionBase * )OpenLibrary((UBYTE *)"intuition.library" , 37)))
  602.         return( 0L );
  603. CloseLibs();
  604. return( 1L );
  605. }
  606.  
  607. void CloseLibs( void )
  608. {
  609. if (NULL != DiskfontBase )
  610.   CloseLibrary( DiskfontBase );
  611. if (NULL != GadToolsBase )
  612.   CloseLibrary( GadToolsBase );
  613. if (NULL != GfxBase )
  614.   CloseLibrary( ( struct Library * )GfxBase );
  615. if (NULL != IntuitionBase )
  616.   CloseLibrary( ( struct Library * )IntuitionBase );
  617. if (NULL != LocaleBase )
  618.   CloseLibrary( ( struct Library * )LocaleBase );
  619. }
  620.  
  621. int OpenDiskFonts( void )
  622. {
  623.   int OKSoFar = 0;
  624. if (NULL == OpenDiskFont( &HBBS8066 ) )
  625.   OKSoFar = 1;
  626. if (NULL == OpenDiskFont( &topa81281 ) )
  627.   OKSoFar = 1;
  628. return ( OKSoFar );
  629. }
  630.  
  631. int MakeImages( void )
  632. {
  633. UWORD failed = 0;
  634. if (NULL != (WaitPointer=AllocMem( 72, MEMF_CHIP)))
  635.   CopyMem( WaitPointerData, WaitPointer, 72);
  636. else
  637.   failed = 1;
  638. if (failed==0)
  639.   return( 0L );
  640. else
  641.   {
  642.   FreeImages();
  643.   return( 1L );
  644.   }
  645. }
  646.  
  647. void FreeImages( void )
  648. {
  649. if (WaitPointer != NULL)
  650.   FreeMem( WaitPointer, 72);
  651. WaitPointer = NULL;
  652. }
  653.  
  654.